Use adapted bounds for method type arguments#1850
Open
aosen-xiong wants to merge 12 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Checker Framework’s method-invocation type argument checking to use viewpoint-adapted bounds for method type parameters, and adds a viewpoint test to exercise both explicit and inferred method type arguments against those adapted bounds.
Changes:
- Add
AnnotatedTypeFactory.methodTypeVariablesFromUse(...)to compute method type-parameter bounds in the invocation’s viewpoint. - Use the new adapted-bounds helper from
BaseTypeVisitor.visitMethodInvocation(...)when validating method type arguments. - Add a new viewpoint test covering explicit and inferred method type arguments with receiver-dependent bounds.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| framework/tests/viewpointtest/MethodTypeVariableBounds.java | New test cases for receiver-dependent method type parameter bounds under different receiver viewpoints. |
| framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java | Introduces a helper to compute invocation-viewpoint-adapted method type parameter bounds. |
| framework/src/main/java/org/checkerframework/common/basetype/BaseTypeVisitor.java | Switches method invocation type-argument checking to use adapted bounds from the factory helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aosen-xiong
commented
Jul 6, 2026
AnnotatedTypeCopierWithReplacement skips executable type parameters, so adapted method/constructor type-variable bounds were discarded and inference still saw unadapted declaration bounds. Install the adapted declarations, drop the redundant post-check re-adaptation helper, and add constructor coverage.
wmdietl
requested changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split from #1173.
Use viewpoint-adapted method type parameter bounds when checking method invocation type arguments.
Adds a viewpoint test covering explicit and inferred type arguments.